package cn.edu.hust.youth.tzb.servlet.student;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.edu.hust.youth.tzb.model.Student;

public class Logout extends HttpServlet {
	private static final String CONTENT_TYPE = "text/html; charset=GBK";
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType(CONTENT_TYPE);
		HttpSession session = request.getSession(true);
//		Student s=(Student)session.getAttribute("STUDENT");
//		System.out.println("-----------------"+s.getName());
		session.removeAttribute("STUDENT");
		String target = "/student/logout.jsp";
		RequestDispatcher rd = this.getServletContext()
				.getRequestDispatcher(target);
		rd.forward(request, response);
	}

	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(req, resp);
	}

}
